import { ModuleWithProviders, NgModule, Provider } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { HttpClientModule } from '@angular/common/http';
import { NgZorroAntdMobileModule } from 'ng-zorro-antd-mobile';
const DIRECTIVES: Provider = []; // 公共指令
const PIPES = []; // 公共管道
const COMPONENT = []; // 公共组件
const NAVTIVE = [InAppBrowser, SplashScreen, StatusBar]; // 原生组件服务
const MODULES = [
  CommonModule,
  FormsModule,
  IonicModule,
  HttpClientModule,
  NgZorroAntdMobileModule
];

@NgModule({
  imports: [...MODULES],
  declarations: [...DIRECTIVES, ...PIPES, ...COMPONENT],
  providers: [...DIRECTIVES, ...PIPES, ...NAVTIVE],
  exports: [...MODULES, ...DIRECTIVES, ...PIPES, ...COMPONENT]
})
export class SharedModule {
  static forRoot(): ModuleWithProviders {
    return {
      ngModule: SharedModule
    };
  }
}
